From 2f991e680bea37d1f97ea77df2343200f3899817 Mon Sep 17 00:00:00 2001 From: Anurag Date: Wed, 28 Feb 2024 21:13:25 +0530 Subject: feat: initialise a new totals tab with basic UI (#94) * feat: initialise a new totals tab with basic UI * fix: update group tabs and add stats page * fix: styling within the new elements * Prettier * Display active user expenses only if active user is set --------- Co-authored-by: Sebastien Castiel --- src/app/groups/[groupId]/stats/page.tsx | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/app/groups/[groupId]/stats/page.tsx (limited to 'src/app/groups/[groupId]/stats/page.tsx') diff --git a/src/app/groups/[groupId]/stats/page.tsx b/src/app/groups/[groupId]/stats/page.tsx new file mode 100644 index 0000000..eb7fa9e --- /dev/null +++ b/src/app/groups/[groupId]/stats/page.tsx @@ -0,0 +1,49 @@ +import { cached } from '@/app/cached-functions' +import { Totals } from '@/app/groups/[groupId]/stats/totals' +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from '@/components/ui/card' +import { getGroupExpenses } from '@/lib/api' +import { getTotalGroupSpending } from '@/lib/totals' +import { Metadata } from 'next' +import { notFound } from 'next/navigation' + +export const metadata: Metadata = { + title: 'Totals', +} + +export default async function TotalsPage({ + params: { groupId }, +}: { + params: { groupId: string } +}) { + const group = await cached.getGroup(groupId) + if (!group) notFound() + + const expenses = await getGroupExpenses(groupId) + const totalGroupSpendings = getTotalGroupSpending(expenses) + + return ( + <> + + + Totals + + Spending summary of the entire group. + + + + + + + + ) +} -- cgit v1.3